home *** CD-ROM | disk | FTP | other *** search
- /* mpega script for use with AmIRC 1.x
- $VER: mpega.amirx 1.00 (25.05.97)
- // Written by Deryk Robosson 25.05.97
- //
- // newlook@ameritech.net newlook on #amiga IRC (IRCNet)
- //
- // 25.05.97 - Initial Creation
- */
-
- /* user setable variables */
- mpega_path = 'c:mpega' /* path to mpega */
- mpega_options = '-q 0 -d 4 -m' /* mpega options (refer to mpega docs for settings */
- def_dir = 'data:convert/' /* default path to mpeg files (MUST end in a '/' or ':') */
- show_info = 1 /* 1 = show info to window, 0 = do not show */
-
- /* shouldn't need to change anything below here */
- bold = d2c(2)
- underline = '1F'x
- options results
- parse arg param
- check=param
- if upper(check) = 'VER' then signal version
- if upper(check) = 'HELP' then signal help
- if check = '' then do
- /* see if we're already playing, if so, break the process */
- if getclip('mpega_playing') = '1' then do
- address command 'status com='mpega_path' >t:mpega.temp'
- if open(file,'t:mpega.temp','R') then pid=readln(file)
- close(file)
- address command 'delete t:mpega.temp force quiet'
- address command 'break process 'pid
- setclip('mpega_playing','0')
- end
- else do /* we weren't playing, notify user */
- call echo('You are not playing anything.')
- signal version
- end
- exit
- end
-
- /* check to see if the file exists */
- if ~exists(def_dir||param) then do
- call echo(def_dir||param' not found.')
- exit
- end
-
- /* show the mpeg info if show_info is TRUE */
- if show_info then do
- address command mpega_path' -h 'def_dir||param' >t:mpega.temp'
- if open(file,'t:mpega.temp','R') then do
- do until eof(file)
- line=readln(file)
- if pos('bps',line) > 0 then do
- parse var line time' 'type' 'mode' 'bitrate' 'hz
- call echo(bold||underline||type' 'mode||bold||underline' 'bold'Time:'bold' 'time' - 'bold'Kbps:'bold' 'bitrate' - 'bold'Khz:'bold' 'hz)
- end
- end
- end
- close(file)
- address command 'delete t:mpega.temp force quiet' /* clean up */
- end
-
- setclip('mpega_playing','1') /* make note that we are playing */
- call echo(bold'Playing:'bold' 'def_dir||param)
- address command mpega_path' 'mpega_options' 'def_dir||param' >NIL:' /* play it */
- exit
-
- version: /* show the user version information */
- call echo(bold'mpega.AMIRX'bold' Version 'subword(sourceline(2),4,2))
- call echo('Read the top of mpega.AMIRX script for history.')
- call echo(bold'©1997'bold' Deryk Robosson 'bold'(newlook)'bold' - [newlook@ameritech.net]')
- call echo(bold'Type /mp help for command information')
- exit
-
- help: /* show the user help examples */
- call echo(bold'mpega.AMIRX'bold' Help')
- call echo(bold'VER -'bold'displays script version')
- call echo(bold'HELP - 'bold'displays this file')
- call echo(bold||UNDERLINE'EXAMPLES:'bold||UNDERLINE)
- call echo(bold'/mp <song>'bold' to play a song')
- call echo(bold'/mp'bold' to stop play')
- exit
-
- echo: procedure
- parse arg a
- 'echo P='d2c(27)'b«mpega» 'a
- return 1
-